package com.bruan.d1_io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class FileOutputStreamTest1 {
    public static void main(String[] args) throws IOException {
//        OutputStream os = new FileOutputStream("file-io-app\\zlive.txt");//文件会自动生成
        OutputStream os = new FileOutputStream("file-io-app\\zlive.txt",true);//追加数据
        //一次写入 一个字节
        os.write(97);
        os.write('a');
        //一次性 写多个字节
        byte[] bytes = "我爱你中国".getBytes();
        os.write(bytes);
        //自定范围
        os.write(bytes,0,15);
        //换行
        os.write("\r\n".getBytes());
        os.close();

    }
}
